/**
 * 弹出框支持拖动，引用jquery-ui里方法
 * Created by liaofei on 2014-10-23.
 */
define(["app"], function (app) {

    var deps = ["$parse", "$window"];

    function directive ($parse, $window) {
        var $win = $($window);
        return {
            restrict: "C",
            link: function ($scope, elem, attrs) {

                elem.draggable({
                    //$win = jQuery(window)  [70, 59, Math.max($win.width() - 870, 70), Math.max($win.height() - 600, 59)]
                    //containment: [30, 20, Math.max($win.width() - 640, 30), Math.max($win.height() - 500, 20)],
                    //handle: '.mode-title',
                    containment: "window",
                    handle: '.mode-title,.widgetcontent',
                    cursor: 'move'
                });

            }
        };
    }

    directive.$inject = deps;
    app.lazy.directive("modalContent", directive);
});